package com.ck;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Controller
@EnableWebMvc
@SpringBootApplication
@MapperScan(basePackages = "com.ck.mapper") // 扫描mapper
public class Application extends WebMvcConfigurerAdapter implements CommandLineRunner { // WebMvcConfigurerAdapter为配置拦截器http://lihao312.iteye.com/blog/2078139
	// CommandLineRunner 项目服务启动的时候就去加载一些数据或做一些事情这样的需求
	private Logger logger = LoggerFactory.getLogger(Application.class);

	public static void main(String[] args) {

		SpringApplication.run(Application.class, args);

	}

	public void run(String... arg0) throws Exception {
		logger.info("服务启动完成!");
	}

	@RequestMapping("/")
	String home() {
		return "redirect:countries";
	}

}
